<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link
      href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css"
      rel="stylesheet"
    />
    <style>
      label {
        font-weight: normal;
      }
      .panel-body .glyphicon-remove{
        display: none;
      }
      .panel-body:hover .glyphicon-remove{
        display: inline-block
      }
    </style>
  </head>
  <body>
    <div class="container">
      <div class="row">
        <div class="col-xs-12 col-lg-8 col-lg-offset-2">
          <h2>欢迎<%= name %></h2>
		  <h2><form action="/student" method="get"><button >记账本</button></form></h2>
		  <h2 style="margin-left: 685px;"><a href="/logout">退出</a></h2>
          <hr />
          <div class="accounts">
			  <% students.forEach(item=>{%>
            <div class="panel <%=item.type==='支出'?'panel-danger':'panel-success'%>">
              <div class="panel-heading"><%=moment(item.time).format('YYYY-MM-DD')%><span><form action="/students/update/:id" method="get"><button ><a href="/students/update/<%=item._id%>">修改</a></button></form></span></div>
              <div class="panel-body">
                <div class="col-xs-6">事件：<%=item.username%></div>
                <div class="col-xs-2 text-center">
                  <span class="label <%=item.type==='支出'?'label-warning':'label-success'%>">类型：<%=item.type==='支出'?'支出':'收入'%></span>
                </div>
                <div class="col-xs-2 text-right">金额:<%=item.money%>元</div>
                <div class="col-xs-2 text-right">
					<a href="/students/<%=item._id%>">
						<span
                    class="glyphicon glyphicon-remove"
                    aria-hidden="true"
                  ></span></a>
                </div>
              </div>
            </div>
			<%})%>
        </div>
      </div>
    </div>
  </body>
</html>
